/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.Arrays;
import java.util.Comparator;

/**
 * <p>Project: app2022 - ArrSort1
 * <p>Powered by webrx On 2022-01-08 16:26:29
 *
* @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class ArrSort3 {
    public static void main(String[] args) {
        var ss = new String[]{"java", "python", "c", "php", "go", "ruby", "javascript"};
        //未排序
        System.out.println(Arrays.toString(ss));

        //升序
        Arrays.sort(ss);
        System.out.println(Arrays.toString(ss));

        //降序
        Arrays.sort(ss, Comparator.reverseOrder());
        System.out.println(Arrays.toString(ss));

        //乱序
        Arrays.sort(ss, (a, b) -> Math.random() > .5 ? 1 : -1);
        System.out.println(Arrays.toString(ss));

    }
}
